/**
 * 
 */
package eg.edu.eelu.fyp2013.jdetector.core.filters.impl;

import java.awt.Color;

public class MeanFilter extends AbstractWindowFilter {

	public MeanFilter(int filterWidth, int filterHeight) {
		super(filterWidth, filterHeight);
	}

	/* (non-Javadoc)
	 * @see eg.edu.eelu.fyp2013.jdetector.core.filters.WindowFilter#getFilteredPixel(int[])
	 */
	@Override 
	/**
	 * @author Mohsen
	 *
	 */
	/**-----------------------------------------------------------------
	 */ 
	public int getFilteredPixel(int[] window) {
	// i think we have to deal with boundaries 	
		//TODO Mohsen
		int sum = 0;
		
		for (int i=0; i<window.length; i++){
		     sum += window[i];
		}
	return sum/window.length;
	}
	/**-----------------------------------------------------------------
	 */ 
	/* (non-Javadoc) 
	 * @see eg.edu.eelu.fyp2013.jdetector.core.filters.WindowFilter#getFilteredPixel(int[][])
	 * @author Nafisa
	 */ 
	@Override
	public int getFilteredPixel(int[][] window) {
//		int value;//NOT used
		int sum = 0;
//		int divisor;//NOT used
		
		for (int i = 0; i< window.length; i++){ //extra spaces make it really hard to follow. I removed them
			for (int j = 0; j< window[i].length; j++){
				sum += window[i][j];
			}
		}
		return sum/window.length;
	}
	
	@Override 
	public Color getFilteredPixel(Color[] windowColors) {
		//TODO Ahmed
		return null;
	}

	/* (non-Javadoc) 
	 * @see eg.edu.eelu.fyp2013.jdetector.core.filters.WindowFilter#getFilteredPixel(java.awt.Color[][])
	 */
	@Override
	public Color getFilteredPixel(Color[][] windowColors) {
		//TODO Nafisa
		// I dont know how to do this one
		
		//TODO Simply, by working on each component alone :) 
		//P.S. You can call the other function instead of dublicating your code.
		// Mohsen, You are RESPONSIBLE to teach her how to deal with colors.
		
		return null;
	}


}
